<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // json字符串: 服务返回的数据格式是JSON字符串
        // 特点：属性名要加""
        let jsonStr1 = `{"name": "小花", "age": 18}`

        let jsonStr2 = `[1, 2, 3]`

        // js中提供了两个API来处理json字符串
        // 1. 把json字符串转成对象
        console.log( JSON.parse(jsonStr1) )

        // 2. 把对象转成json字符串
        console.log( JSON.stringify({name: "小花", age: 18}) )

    </script>
</body>
</html>